$("#btn_append").click(function () {

    var max_nums=parseInt($("#max_nums").val());

    var files=$("[name='files']");

    if(files.length>=max_nums){
        alert('最大只能上传'+max_nums+"个附图！");
        return;
    }


    var content = '<div class="form-group row">' +
        '<label class="col-sm-1 text-left control-label col-form-label">商品附图</label>' +
        '<div class="col-md-6">' +
        '<div class="custom-file">' +
        '<input type="file" name="files" class="custom-file-input" id="file" required>' +
        '<label class="custom-file-label" for="file">请选择商品图片</label>' +
        '</div>' +
        '</div>' +
        '<button type="button" onclick="remove(this)" class="btn btn-outline-primary">删除</button>' +
        '</div>';

    $("#imageses").append(content);
})

function remove(element) {
    $(element).parent().remove();
}
